#include<bits/stdc++.h> 
using namespace std;

const int N=1e5+10;

int main()
{
	
	int n,q;
	cin>>n>>q;
	vector<long>arr[N];
	
	while(q--)
	{
		int op;
	    int a,b,c;
		cin>>op;
		if(op==1)
		{
		
			cin>>a>>b>>c;
			
			if(arr[a].size()<=b)
			{
				arr[a].resize(b+1);
			}
			
			arr[a][b]=c;	
		}
		if(op==2)
		{
		
			cin>>a>>b;
			cout<<arr[a][b]<<endl;
		}	
	}
	
	return 0;
} 
